package book.crawler.utils;

import org.apache.commons.lang3.time.FastDateFormat;

/**
 * @author jiale
 * @version 1.0
 * @description这是设置时间的工具
 * @date 2022/07/26 10:34
 **/
public abstract class TimeUtils {
    public static String format(Long timestamp, String pattern) {
        //关于patter:yyyy-MM-dd HH-mm-ss或yyyy年MM月dd日 HH时mm分ss秒或yyyy/MM/dd HH/mm/ss
        //timezone：GMT+8(时区)
        return FastDateFormat.getInstance(pattern).format(timestamp);
    }

    public static void main(String[] args) {
        String format = TimeUtils.format(System.currentTimeMillis(), "yyyy-MM-dd");
        System.out.println(format);
    }
}
